﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace A2DFramework.EventService.SuperSocket.Core.ConsoleEntry
{
    public class ServerStarter
    {
        public static void Start()
        {
            var appServer = new EventDispatcherBusServer();

            if (!appServer.Setup(ServerConfig.Port))
            {
                Console.WriteLine("Failed to setup!");
                Console.ReadKey();
                return;
            }
            Console.WriteLine("Server setup ok.");

            if (!appServer.Start())
            {
                Console.WriteLine("Failed to start!");
                Console.ReadKey();
                return;
            }
            Console.WriteLine("Server started ok.");

            Console.WriteLine("The server started successfully, press any key to stop it!");

            Console.ReadKey();

            appServer.Stop();
        }
    }
}
